
 
package Main;
import GamePlay.*;
import GamePlay.GameObjects.UserShip;
import java.awt.Container;
import java.awt.BorderLayout;
import javax.swing.JFrame;

public class Session 
{
	private Container display;
	public final int GAMEPLAY = 2;
	public final int INTRO = 0;
	private int level;
	public final int LEVEL = 1;
	private int sector;
	public int shipType;
	private String userName;
	private JFrame window;

	public Session(int startLevel, String name, int ship, Container screen,JFrame theWin) 
	{
		level = startLevel;
		userName = name;
		shipType = ship;
		display = screen;
		window = theWin;
	}
	
	public int getSector() 
	{
		return sector;
	}
	public void startGamePlay() 
	{
		sector = GAMEPLAY;
		GameEnv theEnv = new GameEnv();
		UserShip user = new UserShip(theEnv);
		theEnv.addGO(user, 3);
		theEnv.setUser(user);
		GameDisplay playBoard = new GameDisplay(window, theEnv, user);
		swapDisplay(playBoard);
		GamePlay theGamePlay = new GamePlay(level, playBoard, theEnv);
	}
	
	private void swapDisplay(Container newDisplay) 
	{
		display.remove(0);
		newDisplay.setSize(display.getWidth(), display.getHeight());
		display.add(newDisplay, BorderLayout.CENTER);
		display.validate();
		display.repaint();
	}
	
	public void tellLevel() 
	{
		//does the level sign
		sector = LEVEL;
		Level firstLevel = new Level(level, this);
		swapDisplay(firstLevel);
	}
}